package com.huishen.edrivenew.ui;

import com.huishen.edrivenew.AppContext;
import com.huishen.edrivenew.AppManager;
import com.huishen.edrivenew.R;
import com.huishen.edrivenew.base.BaseActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;

public class SettingActivity extends BaseActivity {
    
    private TextView title;
    private Button logout;
    private ImageButton back;
    private LinearLayout softup, opinion, about;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        registView();
        initView();
    }

    private void registView() {
        title = (TextView) findViewById(R.id.header_title);
        back = (ImageButton) findViewById(R.id.header_back);
        softup = (LinearLayout) findViewById(R.id.setting_softup);
        opinion = (LinearLayout) findViewById(R.id.setting_opinion);
        about = (LinearLayout) findViewById(R.id.setting_about);
        logout = (Button) findViewById(R.id.setting_logout);
    }

    private void initView() {
        title.setText("设置");
        back.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                finish();
            }

        });
        logout.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                AppManager.getInstance().logout(SettingActivity.this);
            }
        });
        softup.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // checkSoftwareUpdate();
            }

        });
        about.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Intent i = new Intent(SettingActivity.this, InfoActivity.class);
                i.putExtra("title", "关于我们");
                i.putExtra("url", "www.baidu.com");
                startActivity(i);
            }
        });
        opinion.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Intent i = new Intent(SettingActivity.this, OpinionActivity.class);
                startActivity(i);
            }

        });
    }

    
    private void checkSoftwareUpdate() {
    }



}
